package com.yans.managers
{
	import com.yans.interfaces.ILogManager;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	public class LogManager extends EventDispatcher implements ILogManager {
		
		private static const MAXCOUNT:int = 2000;
		private var _log:Array;
		private var _currentLog:String;
		
		public function LogManager() {
			_log = [];
		}
		
		public function log(log:String):void {
			if(_log.length >= MAXCOUNT) _log.shift();
			_log.push(log);
			_currentLog = log;
			dispatchEvent(new Event(Event.ADDED));
		}
		
		public function get currentMessage():String {
			return _currentLog;
		}
		
		public function get getList():Array {
			return _log;
		}
		
	}
}